package net.shopxx.entity;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.OrderBy;

/**
 * 实体类 - 颜色
 */


@Entity
@Table(name = "product_color")
public class ProductColor extends BaseEntity {

	private static final long serialVersionUID = -6109590619136943215L;

	private Product product;// 名称
	private String descript;// 图片路径
	private String imgUrl;// 图片路径
	private Color color;
//	private Set<Productitem> productitemSet;// 商品项
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(nullable = false)
	public Product getProduct() {
		return product;
	}
	
	public void setProduct(Product product) {
		this.product = product;
	}

	@Column(nullable = true)
	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}
	
	@Column(nullable = true)
	public String getDescript() {
		return descript;
	}

	public void setDescript(String descript) {
		this.descript = descript;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(nullable = false)
    public Color getColor() {
        return color;
    }
    
    public void setColor(Color color) {
        this.color = color;
    }
    
//    @OneToMany(fetch = FetchType.LAZY, mappedBy = "productColor")
//	@Cascade(value = { CascadeType.DELETE })
//	@OrderBy(clause = "modifyDate desc")
//	public Set<Productitem> getProductitemSet() {
//		return productitemSet;
//	}
//
//	public void setProductitemSet(Set<Productitem> productitemSet) {
//		this.productitemSet = productitemSet;
//	}

}